/**
  * @Description: WoShop商城
  * @Author: 梧桐
  * @Copyright: 武汉一一零七科技有限公司©版权所有
  * @Link: www.s1107.com
  * @Contact: QQ:2487937004
  */
<!-- 我的评价 -->
<template>
  <view class="page">
 		<view class="content">
			<!-- 全部订单 -->
			<view class="list">
				<view class="listItem"  v-for="(comment,index) in commentList" :key="index"  @click="getnav('/pagesB/seller/orderDetails?order_num=' +comment.ordernumber)">
          <image class="orderStatusImg" :src="comment.filter==5?imgSTATICURL+'images/icon-orderFail.png':''" />
        	<view class="orderStatus">
						<view class="orderNo f24 c9">订单号:{{comment.ordernumber}}</view>

					</view>
					<view class="goods">
							<image class="goodsPic" :src="comment.goodsinfo.thumb_url?comment.goodsinfo.thumb_url:imgSTATICURL+'images/img-goodsNull@2x.png'"></image>

						<view class="goodsInfo">
							<view class="goodsName f32 c3">{{comment.goodsinfo.goods_name}}</view>
						<view class="totalPrice f24 c6">共{{comment.goodsinfo.goods_num}}件宝贝,应付<text class="priceNum">¥{{comment.total_price}}</text></view>
						</view>
					</view>

				</view>
			</view>
		</view>
	    <loadMore :loadingType="loadingType"></loadMore>
  </view>
</template>

<script>

import uniRate from '@/components/uni-rate/uni-rate.vue';

export default {
 	components: {
		uniRate,
	},
  data() {
    return {
	  imgSTATICURL: this.STATICURL,
      commentList:[],
	  page:1,
      delSrc:''
    }
  },
  onLoad(){

	let params = {
		size: "5",
		page: 1,
		filter:7
	};
    this.getCartApraiseList(params);
    uni.setNavigationBarTitle({
      title:'订单失败'
    });
  },

 onReachBottom() {

	let params = {
		size: "5",
		page: 1,
		filter:7
	};
       this.loadMoreFunc(params);
    },
     onPullDownRefresh() {
        this.page = 1
            this.$nextTick(() => {
                this.getCartApraiseList({
                    size: "5",
                    page: 1,
					filter:7
                }, true);
            })

    },
	methods: {


	   getCartApraiseList(data, refresh) {
            if (this.page == 1 ) {
                this.$loading();
            }
            this.$http.getShopperOrderList(data).then(res => {
                if (res.status === 200) {
                    this.$hideLoading();
                    if (refresh) {
                        this.commentList = res.data;
                        this.loadingType = 0;
                        return false
                    }
                    if (res.data.length == 0) {
                        // console.log(12346789)
                        this.loadingType = 2;
                        return false;
                    }
                    this.commentList = this.commentList.concat(res.data);
                    this.loadingType = 0;
                }
                // uni.stopPullDownrefrash();
            }).catch(() => {
                // uni.stopPullDownrefrash();
            })
        },


		   loadMoreFunc: function (params) {
            // 加载函数

                if (this.loadingType == 1 || this.loadingType == 2) {
                    return false;
                }
                this.loadingType = 1;
                // console.log(999999)
                ++this.page;
                params.page = this.page;

            this.$nextTick(() => {
                this.getCartApraiseList(params);
            })
        },


	  preview: function(urls, urlsId) {
	  uni.previewImage({
	    current: urlsId, //当前显示的 图片
	    indicator: "number",
	    urls: urls // 预览图片的列表
	  });
		}
	}
};
</script>

<style lang="less" scoped>


page {
  background: #f4f4f4;
}
.page{
  .listItem{
    background-color: #ffffff;
    margin: 30upx;
    border-radius: 20upx;
    padding: 30upx;
    position: relative;
  }
  .orderStatusImg{
    position:absolute;
    top: 0upx;
    right: 14upx;
    width: 208upx;
    height: 142upx;
	opacity: 0.6;
  }
  .goods{
    display: flex;
    .goodsPic{
      width: 180upx;
      height: 180upx;
      background-color: #f8f8f8;
      border-radius: 15upx;
    }
    .goodsInfo{
      margin-left: 18upx;
      display: flex;
      justify-content: space-between;
      flex-direction: column;
      .priceNum{
        color: #FA3E3F;
        font-size: 36upx;
        font-weight: 600;
        margin-left: 8upx;
      }
    }
  }
}

</style>
